package cn.jaye.fabric.application;

import cn.jaye.fabric.common.constant.Global;
import cn.jaye.fabric.domain.model.Match;
import cn.jaye.fabric.infrastructure.mybatis.impl.MatchRepositoryImpl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Jaye
 * @create 2018-06-04 15:35
 */
@Service
public class MatchApplicationService {


    @Autowired
    private MatchRepositoryImpl matchRepository;

    public String add() {
        return null;
    }

    public String update() {
        return null;
    }

    public List<Match> listNoStartMatch() {
        return matchRepository.selectList(new EntityWrapper<Match>().eq("match_state", Global.MATCH_STATE_NOT_BEGINNING));
    }

    public List<Match> listInGuessMatch() {
        return matchRepository.selectList(new EntityWrapper<Match>().eq("match_state", Global.MATCH_STATE_NORMAL));
    }

    public List<Match> listEndMatch() {
        return matchRepository.listEndMatch();
    }
    public JSONArray listAllMatch() {
        return matchRepository.listAll();
    }

}
